package org.hazelnuts.accessor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;

@Component
public class MysqlJdbcAccessor {

    @Autowired
    private JdbcTemplate mysqlJdbcTemplate;

    public int create(String sqlString, @Nullable Object... args) {
        return mysqlJdbcTemplate.update(sqlString, args);
    }

    public int query() {
        return mysqlJdbcTemplate.queryForList("Select 1", Integer.class).get(0);
    }
}
